
const TestComp = () => {
  const [visible, setVisible] = useState(false);
  const vars = [
    { name: 'Name', type: 'input' },
    { name: 'Gender', type: 'radio' },
    { name: 'Agree', type: 'switch' },
    { name: 'Hobbies', type: 'checkbox' }
  ];

  const handleCancel = () => {
    setVisible(false);
  };

  const handleSubmit = (values) => {
    console.log('Form values:', values);
    setVisible(false);
  };

  return (
    <div>
      
      <button onClick={() => setVisible(true)}>Open Form</button>
      <OptForm
        vars={vars}
        visible={visible}
        onCancel={handleCancel}
        onSubmit={handleSubmit}
      />
    </div>
  );
};

